#include <stdio.h>

int main()
{
    // ==========================一级指针指向一维数组=========================================
    int arr[5] = {1, 2, 3, 4, 5};
    int *p = arr;

    for (int i = 0; i < 5; i++)
    {
        printf("p[%d] = [%d]\n", i, p[i]);
    }
    // ========================一级指针指向二维数组=================================================
    int arr2[2][3] = {{1, 2, 3}, {4, 5, 6}};
    //int(*p2)[3] = arr2;
    int *p2 = &arr2[0][0]; 
    //int **p3 = arr2;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            printf("p2[%d][%d] = [%d]\n", i, j, *(p2 + i * 3 + j));
        }
    }
}